package com.zhongying.jf.result;

import com.chinazyjr.framework.common.enums.ErrorCodeEnum;

/**
 * @author liyuxuan
 * @Description
 * @Email liyuxuan@chinazyjr.com
 * Created on 2017/8/11 15:13
 * Copyright (c) 2017 All Rights Reserved.
 */
public class ResultSupport<T> implements Result<T> {

	/**
	 *
	 */
	private static final long serialVersionUID = -1802692098484483921L;

	private String code;

	private String msg;

	private T model;

	
	public ResultSupport() {
	}

	
	public ResultSupport(String code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	
	public ResultSupport(String code, String msg, T model) {
		this.code = code;
		this.msg = msg;
		this.model = model;
	}
	
	public ResultSupport(ErrorCodeEnum errorCode,T model) {
		this.code = errorCode.getCode();
		this.msg = errorCode.getMsg();
		this.model = model;
	}
	
	public ResultSupport(ErrorCodeEnum errorCode) {
		this.code = errorCode.getCode();
		this.msg = errorCode.getMsg();
	}
	
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	@Override
	public String getCode() {
		return code;
	}

	@Override
	public void setCode(String code) {
		this.code = code;
	}

	public void setCode(Integer code) {
		this.code = String.valueOf(code);
	}

	@Override
	public String getMsg() {
		return msg;
	}

	@Override
	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public T getModel() {
		return model;
	}

	@Override
	public void setModel(T model) {
		this.model = model;
	}
}
